var t,
  n = require("../../res/www.a9a.cn.js"),
  a = getApp();
Page({
  data: { topbar: ["我的服务人员", "牵线记录", "约见记录"], currentTab: 0 },
  onLoad: function (o) {
    var e = this;
    a.chklogin().then(function (t) {
      t || wx.navigateBack();
    }),
      a.get_openid().then(function (c) {
        e.setData({ color: a._ZEAI.color, rgbcolor: n.c16_rgb(a._ZEAI.color) }),
          (t = wx.getStorageSync("COOK_U"));
        var r = o.currentTab;
        !a.empty(r) && r > 0 && (e.setData({ currentTab: r }), e.get_data(r)),
          a.ajax({
            url: "my_hongniang.php",
            data: { submitok: "index", openid: t.openid },
            success: function (t) {
              1 == t.flag
                ? e.setData({ ARR: t.ARR })
                : wx.showModal({
                    content: t.msg,
                    confirmColor: e.data.color,
                    confirmText: "朕知道了",
                    showCancel: !1,
                    success: function (t) {
                      wx.switchTab({ url: "my" });
                    },
                  });
            },
          });
      });
  },
  onShow: function () {},
  topbarFn: function (t) {
    var n = parseInt(t.currentTarget.dataset.idx);
    this.setData({ currentTab: n }), n > 0 && this.get_data(n);
  },
  telFn: function (t) {
    var n = t.currentTarget.dataset.tel;
    wx.makePhoneCall({ phoneNumber: n });
  },
  get_data: function (n, o) {
    a.chklogin().then(function (t) {
      t || wx.navigateBack();
    });
    var e = this;
    (t = wx.getStorageSync("COOK_U")),
      (n = 2 == n ? "yj" : "qx"),
      a.ajax({
        url: "my_hongniang.php",
        data: { submitok: "list", t: n, f: o, openid: t.openid },
        success: function (t) {
          1 == t.flag
            ? e.setData({ NUM: t.NUM, LIST: t.LIST })
            : wx.showModal({
                content: t.msg,
                confirmColor: e.data.color,
                confirmText: "朕知道了",
                showCancel: !1,
                success: function (t) {
                  wx.navigateBack();
                },
              });
        },
      });
  },
  hnFn: function () {
    wx.reLaunch({ url: "../hn/hn" });
  },
});
